import lombok.Data;

import java.io.IOException;
import java.net.Socket;

@Data
public class Address {
    String ip;
    Integer port;
    public Address(String ip, Integer port) {
        this.port = port;
        this.ip = ip;
    }
    public Socket connectToAddress() throws IOException {
        return new Socket(ip, port);
    }

    public Address(Socket socket) {
        this.ip = socket.getInetAddress().getHostAddress();
        this.port = socket.getPort();
    }
}
